/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package jpa.entities;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Embeddable;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;

/**
 *
 * @author Giovanni
 */
@Embeddable
public class AckPK implements Serializable {
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 20)
    @Column(name = "USER_MAIL")
    private String userMail;
    @Basic(optional = false)
    @NotNull
    @Column(name = "EVENT_ID")
    private int eventId;
    @Basic(optional = false)
    @NotNull
    @Column(name = "INVITE_EVENT_ID")
    private int inviteEventId;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 20)
    @Column(name = "INVITE_SENDER")
    private String inviteSender;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 20)
    @Column(name = "INVITE_RECEIVER")
    private String inviteReceiver;

    public AckPK() {
    }

    public AckPK(String userMail, int eventId, int inviteEventId, String inviteSender, String inviteReceiver) {
        this.userMail = userMail;
        this.eventId = eventId;
        this.inviteEventId = inviteEventId;
        this.inviteSender = inviteSender;
        this.inviteReceiver = inviteReceiver;
    }

    public String getUserMail() {
        return userMail;
    }

    public void setUserMail(String userMail) {
        this.userMail = userMail;
    }

    public int getEventId() {
        return eventId;
    }

    public void setEventId(int eventId) {
        this.eventId = eventId;
    }

    public int getInviteEventId() {
        return inviteEventId;
    }

    public void setInviteEventId(int inviteEventId) {
        this.inviteEventId = inviteEventId;
    }

    public String getInviteSender() {
        return inviteSender;
    }

    public void setInviteSender(String inviteSender) {
        this.inviteSender = inviteSender;
    }

    public String getInviteReceiver() {
        return inviteReceiver;
    }

    public void setInviteReceiver(String inviteReceiver) {
        this.inviteReceiver = inviteReceiver;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (userMail != null ? userMail.hashCode() : 0);
        hash += (int) eventId;
        hash += (int) inviteEventId;
        hash += (inviteSender != null ? inviteSender.hashCode() : 0);
        hash += (inviteReceiver != null ? inviteReceiver.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof AckPK)) {
            return false;
        }
        AckPK other = (AckPK) object;
        if ((this.userMail == null && other.userMail != null) || (this.userMail != null && !this.userMail.equals(other.userMail))) {
            return false;
        }
        if (this.eventId != other.eventId) {
            return false;
        }
        if (this.inviteEventId != other.inviteEventId) {
            return false;
        }
        if ((this.inviteSender == null && other.inviteSender != null) || (this.inviteSender != null && !this.inviteSender.equals(other.inviteSender))) {
            return false;
        }
        if ((this.inviteReceiver == null && other.inviteReceiver != null) || (this.inviteReceiver != null && !this.inviteReceiver.equals(other.inviteReceiver))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "jpa.entities.AckPK[ userMail=" + userMail + ", eventId=" + eventId + ", inviteEventId=" + inviteEventId + ", inviteSender=" + inviteSender + ", inviteReceiver=" + inviteReceiver + " ]";
    }
    
}
